
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

> # with intercept, Charlotte as ref
> estimate.poisson.rhoU2 <- function(data,confounder){
+   vars <- c("White","Houston","King_County","Los_Angeles",
+             "Orlando","San_Jose","Seattle",
+             "Tucson","trauma10")
+   vars_rhs <- vars[!vars %in% confounder]
+   f <- as.formula(paste(confounder,
+                         paste(vars_rhs,collapse = "+"),
+                         sep="~"))
+   fit <- glm(f, data = data,
+              family = poisson(link = "log"))
+   return(fit)
+ }
> 
> bias.factor <- function(RR_UY, RR_rhoU){
+   b <- (RR_UY*RR_rhoU) / (RR_UY + RR_rhoU - 1)
+   return(b)
+ }
> 
> cluster.pois2 <- function(data, indices){
+   d <- data[indices,]
+   fit <- fepois(fatal ~ White + trauma10 + city_factor,
+                 data = d,
+                 se = "cluster",
+                 cluster = cluster_variable)
+   coef <- fit$coefficients
+   return(coef)
+ }
> 
> proc.time()
   user  system elapsed 
 12.763   0.256  13.071 
